const contentBox = document.querySelector('.list')
const contentBox_tj = document.querySelector('.list_tj')
console.log(contentBox);
console.log(contentBox_tj);


const fe = new XMLHttpRequest
    fe.open('GET','/fe?limit=60&offset=0')
    fe.onload = function () {
        const res = JSON.parse(fe.responseText)
        console.log(res.data.hotProduct[0])
        let str = ''
    res.data.hotProduct.forEach(item => {
        str += `
        <li>
            <div class="show">
            <img src="${ item.products.coverUrl }" alt="" style="width:100%;">
            </div>
            <div class="info">
            <p class="name">${ item.name }</p>
            <p class="price">
                <span class="newPrice">￥ ${ item.maxPrice }</span>
            </p>
            </div>
        </li>
        `
    })
    contentBox_tj.innerHTML = str
    }
    fe.send()



    



const f = new XMLHttpRequest
    f.open('GET','/f?limit=60&offset=0')
    f.onload = function () {
        const res = JSON.parse(f.responseText)
        console.log(res.data.allProduct[0])
        let str = ''
    res.data.allProduct.forEach(item => {
        str += `
        <li>
            <div class="show">
            <img src="${ item.coverUrl }" alt="" style="width:100%;">
            </div>
            <div class="info">
            <p class="name">${ item.name }</p>
            <p class="price">
                <span class="newPrice">￥ ${ item.originalCost }</span>
            </p>
            </div>
        </li>
        `
    })
    contentBox.innerHTML = str
    }
    f.send()
